var vue = new Vue({
    el: "#app",
    data: {
        /* {
            "id": 1,
            "topicName": "春节过年回家",
            "initiatorId": 1,
            "initiatorName": "admin",
            "detailIds": null,
            "num": 3
        } */
        topicList: [],
        content: "",
    },
    methods: {
        getTopicList() {
            ajaxGet("/topic/topicList", {}, (data) => {
                this.topicList = data.data;
                console.log(this.topicList);
            });
        },
        submitTopic() {
            ajaxPost(
                "/topic/submitTopic",
                {
                    // TODO: 登录功能完成后直接从cooki中获取
                    userId: 1,
                    userName: "admin",
                    content: this.content,
                },
                (data) => {
                    if (data.code == 200) {
                        this.getTopicList();
                    }
                }
            );
        },
    },
    filters: {},
    created: function () {
        this.getTopicList();
    },
    mounted: function () {},
});
